package msr.service;

import java.sql.Connection;
import java.sql.DriverManager;
import java.util.logging.Logger;

import msr.util.Configure;

public class OracleService {
	private static final Logger log = Logger.getLogger(OracleService.class
			.getName());

	/**
	 * check login
	 * */
	public boolean isLogin(String username, String passwd) {
		/*
		 * Connection con = this.isConnect(); if (con != null) {
		 * log.info("connect success"); return true; }
		 * 
		 * return false;
		 */
		if (username.equals("admin") && passwd.equals("admin"))
			return true;
		else
			return false;
	}

	/**
	 * connect to oracle database
	 * */
	public Connection isConnect() {
		Connection con = null;
		try {
			Class.forName(Configure.ORACLE_DRIVERNAME);
			con = DriverManager.getConnection(Configure.ORACLE_SERVICE,
					Configure.ORACLE_USERNAME, Configure.ORACLE_PASSWORD);
		} catch (Exception e) {
			log.info(e.getMessage());
		}
		return con;
	}
}
